from rest_framework import serializers
from realize.models.station import Station
from realize.models.FaStation import FaStation
from realize.models.category.StationCategory import StationCategory
from realize.models.category.FaStationCategory import FaStationCategory
from realize.models.Stuff import Stuff
from realize.models.category.StuffCategory import StuffCategory
from realize.models.AirLineData import AirLineData


class StuffCategorySerializer(serializers.ModelSerializer):
    class Meta:
        model = StuffCategory
        fields = '__all__'


class StuffSerializer(serializers.ModelSerializer):
    category = StuffCategorySerializer()

    class Meta:
        model = Stuff
        fields = ['count', 'category']


class StationCategorySerializer(serializers.ModelSerializer):
    class Meta:
        model = StationCategory
        fields = '__all__'


class FaStationCategorySerializer(serializers.ModelSerializer):
    class Meta:
        model = FaStationCategory
        fields = '__all__'


class FaStationSerializer(serializers.ModelSerializer):
    class Meta:
        model = FaStation
        fields = ["name"]


class StationSerializer(serializers.ModelSerializer):
    category = StationCategorySerializer()
    attach = FaStationSerializer()

    class Meta:
        model = Station
        fields = ["location", "frequency", "name", "address", "category", "attach"]


class AirLineDataSerializer(serializers.ModelSerializer):
    by_station = StationSerializer()

    class Meta:
        model = AirLineData
        fields = '__all__'
